package com.model;

// Generated 2013-8-25 14:56:38 by Hibernate Tools 3.6.0

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * Tag generated by hbm2java
 */
@Entity
@Table(name = "tag")
public class Tag implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1476333731475701718L;
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Integer id;
	@Column(name = "name", nullable = false, length = 32)
	private String name;
	@Column(name = "description")
	private String description;

	@Column(name = "is_elite", nullable = false)
	private int isElite;

	@Column(name = "image")
	private String image;

	@Column(name = "article_num", nullable = false)
	private int articleNum;

	@Column(name = "question_num", nullable = false)
	private int questionNum;

	@Column(name = "user_num", nullable = false)
	private int userNum;

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "user_tag", catalog = "askme", joinColumns = { @JoinColumn(name = "tag_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "user_id", nullable = false, updatable = false) })
	private Set<User> users = new HashSet<User>(0);
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "question_tag", catalog = "askme", joinColumns = { @JoinColumn(name = "tag_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "question_id", nullable = false, updatable = false) })
	private Set<Question> questions = new HashSet<Question>(0);
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "article_tag", catalog = "askme", joinColumns = { @JoinColumn(name = "tag_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "article_id", nullable = false, updatable = false) })
	private Set<Article> articles = new HashSet<Article>(0);

	public Tag() {
	}

	public Tag(String name) {
		this.name = name;
	}

	public Tag(String name, String description, Set<User> users, Set<Question> questions,
			Set<Article> articles) {
		this.name = name;
		this.description = description;
		this.users = users;
		this.questions = questions;
		this.articles = articles;
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Set<User> getUsers() {
		return this.users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

	public Set<Question> getQuestions() {
		return this.questions;
	}

	public void setQuestions(Set<Question> questions) {
		this.questions = questions;
	}

	public Set<Article> getArticles() {
		return this.articles;
	}

	public void setArticles(Set<Article> articles) {
		this.articles = articles;
	}

	public int getIsElite() {
		return isElite;
	}

	public void setIsElite(int isElite) {
		this.isElite = isElite;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public int getArticleNum() {
		return articleNum;
	}

	public void setArticleNum(int articleNum) {
		this.articleNum = articleNum;
	}

	public int getQuestionNum() {
		return questionNum;
	}

	public void setQuestionNum(int questionNum) {
		this.questionNum = questionNum;
	}

	public int getUserNum() {
		return userNum;
	}

	public void setUserNum(int userNum) {
		this.userNum = userNum;
	}

}
